package com.bo;

import java.util.Comparator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

/**
 * @Author: gpb
 * @Date: 2024/3/16 20:44
 * @Description:
 */
public class A {

    private static class MyComparator implements Comparator<String> {
        @Override
        public int compare (String o1, String o2) {
            return 0;
        }
    }

    private A () {
    }

    private volatile static A a = null;

    public static A getInstance () {
        if (a == null) {
            synchronized (A.class) {
                if (a == null) {
                    a = new A();
                }
            }
        }
        return a;
    }

    public static void main (String[] args) {
        Executors.defaultThreadFactory();
        ExecutorService executorService = Executors.newFixedThreadPool(500);
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            int finalI = i;
            executorService.execute(() -> {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println(Thread.currentThread().getName() + "执行任务：" + finalI);
            });
        }
    }
}
